define(function(require){
    var main = require('/static/main.js');
    var m = new main();
    var webpay = {
        OrderId:$_GET['orderid'],
        init:function(){
            this.isBatchPaid();
        },
        isBatchPaid:function(){
            var interval = setInterval(go,5000);
            function go(){
                $.ajax({
                    type: "POST",
                    url: "/pay/is-paid",
                    data :{OrderId:webpay.OrderId},
                    dataType: "json",
                    success: function (ret){
                        if(ret.IsBizSuccess){
                            if(ret.Model.IsPay){
                                clearInterval(interval);
                                window.location.href = "/pay/paystatus?orderid="+webpay.OrderId;
                            }
                        }
                    }
                });




            }
        }
    }
    webpay.init();

})